package geez.widget;

import com.google.gwt.dom.client.Element;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.MultiWordSuggestOracle;

import java.util.Arrays;

public class GSuggestBoxTest extends GWTTestCase {
    public String getModuleName() {
        return "geez.GeezTest";
    }

    /*
    - Flag to show all on focus, or only on first character.
    - Pop shows list of xxx number closest suggestions.
    - Filters as you type.
    - Up & down arrows change selection.
    - Enter chooses.
    - Tab chooses and unfocuses.
    - Clicking off hides suggest.
    - Tabbing off hides suggest.
    - Ids for textbox and popup.
    - Pluggable renderer for suggestion items.
     */

    public void testNumberOfSuggestions() {
        MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
        oracle.addAll(Arrays.asList("10", "11", "12", "13", "14", "15", "16", "17", "18", "19"));
        GTextBox textBox = new GTextBox();
        GSuggestBox suggestBox = new GSuggestBox(oracle, textBox).id("suggestBox");
        suggestBox.textBox.setFocus(true);
        Element element = DOM.getElementById("suggestBox.popup");
        assertEquals(10, element.getChildNodes().getLength());
    }

    public void testStuff() {
        assertEquals(2 + 2, 4);
    }
}
